<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

class IndexController extends Controller
{

	//构造函数
	public function __init()
	{
	}
	
    //首页显示数据
    public function index()
    {
    	$data = Db::table('shop_cat')->get();
    	$cat = Data::channelLevel($data, $pid = 0, $html = "&nbsp;", $fieldPri = 'cat_id', $fieldPid = 'pid'); 
        $polo = Db::table('shop_goods')->where('cat_id',16)->limit(5)->get();
        $gt = Db::table('shop_goods')->where('cat_id',11)->limit(2)->get();
        View::with('polo',$polo)->with('gt',$gt);
    	View::with('cat',$cat);
        View::make();
    }

    //退出登录
    public function out()
    {
        session_unset();
        session_destroy();
        go('index');        
    }

    public function changeuser()
    {
        session_unset();
        session_destroy();
        go('Login/login');
    }
}
